package com.example.logprocess.writers;

import com.example.logprocess.repository.entity.LogEntity;
import com.example.logprocess.repository.maper.LogMapper;
import org.springframework.batch.item.ItemWriter;

import java.util.List;

public class LogWriter implements ItemWriter<LogEntity> {

    private final LogMapper logMapper;

    public LogWriter(LogMapper logMapper) {
        this.logMapper = logMapper;
    }

    @Override
    public void write(List<? extends LogEntity> list) throws Exception {
        list.forEach(logMapper::insert);
    }
}
